<template>
	<view class="content bgGray">
		<view class="bgWhite ver-c flex-r p16">
			<image
				src="https://wxapi.yixiang.co/api/file/pic/20231118094728501479.png"
				style="width: 104rpx; height: 104rpx"
				mode="aspectFill"
			></image>
			<view class="f1 pl16">
				<view class="">{{ form.tMembername }}</view>
				<view class="fs13 mt6 gray">绑定手机号：{{ form.tPhone }}</view>
			</view>
		</view>
		<view
			class="bgWhite mt6 flex-r jsb p16"
			style="border-bottom: 1rpx solid #eee"
		>
			<view>昵称</view>
			<view class="gray">
				<input
					type="text"
					class="textRight"
					v-model="form.tMembername"
				/>
			</view>
		</view>
		<view
			class="bgWhite flex-r jsb p16"
			style="border-bottom: 1rpx solid #eee"
		>
			<view>ID</view>
			<view class="gray flex-r ver-c">
				{{ form.tMemberno }}
				<u-icon name="lock" size="24"></u-icon>
			</view>
		</view>
		<view
			class="bgWhite flex-r jsb p16"
			style="border-bottom: 1rpx solid #eee"
		>
			<view>手机号</view>
			<view class="gray">
				{{ form.tPhone }}
				<!-- <input type="text" class="textRight" v-model="form.tMembername" /> -->
			</view>
		</view>
		<view class="savebtn textCenter white" @tap="save('aaa')">保存</view>
		<view class="savebtn2 textCenter" @tap="logout">退出登录</view>
	</view>
</template>

<script>
import Utils from '@/utils/utils.js'
import { editInfo } from '@/api/mine.js'
import { throttle } from '@/utils/comm.js'
export default {
	data() {
		return {
			form: {
				tMemberid: '',
				tMembername: '13261076666',
				tPhone: '13261076666',
				tMemberno: '' //会员编号
			}
		}
	},
	onLoad(option) {
		console.log(option)
		this.form.tMemberid = option.tMemberid
		this.form.tMembername = option.tMembername
		this.form.tPhone = option.tPhone
		this.form.tMemberno = option.tMemberno
	},
	methods: {
		save: throttle(function (e) {
			let params = {
				tMemberid: this.form.tMemberid,
				tMembername: this.form.tMembername,
				tPhone: this.form.tPhone
			}
			console.log(params)
			editInfo(params).then(
				(res) => {
					if (res.code == 200) {
						uni.switchTab({
							url: '/pages/mine/mine',
							success: () => {
								setTimeout(() => {
									Utils.toast(res.msg)
								}, 300)
							}
						})
					}
				},
				(err) => {
					console.log(err)
				}
			)
		}),
		logout() {
			Utils.showModel('你确定要退出吗').then(
				(res) => {
					console.log(res)
					uni.removeStorageSync('tokenKey')
					console.log('qued1')
					uni.navigateTo({
						url: '/pages_B/login/login'
					})
				},
				(err) => {
					console.log(err)
					console.log('qx')
				}
			)
		}
	}
}
</script>

<style lang="stylus" scoped>
.content
	height 100%
.mt6
	margin-top 12rpx
.savebtn
	margin 60rpx 32rpx 0
	border-radius 50rpx
	background #c40414
	line-height 90rpx
.savebtn2
	margin 32rpx 32rpx
	border-radius 50rpx
	border 1rpx solid #c40414
	color #c40414
	line-height 90rpx
</style>
